import request from "@/utils/request";
import { stringify } from "qs";
import { toFormData } from "@/utils/utils.jsx";

// 组合商品列表
export async function getCombinationSkuList(params) {
	return request(`/new-goods/goods/combination/sku/list?${stringify(params)}`, {
		loading: true
	});
}

// 获取组合商品详情
export async function getCombinationInfo(params) {
	return request(`/new-goods/goods/combination/sku/combination/get-info?${stringify(params)}`);
}
// 新增单个组合商品
export async function combinationSingleSubmit(params) {
	return request(`/new-goods/goods/combination/sku/combination/submit`, {
		method: "post",
		data: params,
		loading: true
	});
}
// 批量新增组合商品
export async function combinationBatchSubmit(params) {
	return request(`/new-goods/goods/combination/sku/batch-add-combination-sku`, {
		method: "post",
		data: params,
		loading: true
	});
}
// 删除组合商品
export async function combinationDelSubmit(params) {
	return request(`/new-goods/goods/combination/sku/combination/del?${stringify(params)}`, {
		method: "DELETE"
	});
}
// 批量删除组合商品
export async function combinationBatchDelSubmit(params) {
	return request(`/new-goods/goods/combination/sku/combination-batch/del`, {
		method: "Post",
		data: params,
		loading: true
	});
}

// 新增商品列表(sku)
export async function getGoodsSkuPage(params) {
	return request(`/new-goods/goods/sku/list`, {
        method: "Post",
		data: params,
		loading: true
	});
}

// 新增商品列表(spu)
export async function getGoodsSpuPage(params) {
	return request(`/new-goods/goods/spu/list`, {
        method: "Post",
		data: params,
		loading: true
	});
}


// 同步/禁止状态
export async function updateSyncStatus(params) {
	return request(`/new-goods/goods/combination/sku/batch-update-sync-status`, {
		method: "put",
		data: params,
		loading: true
	});
}
// 批量修改sku状态
export async function updateSkuStatus(params) {
	return request(`/new-goods/goods/sku/batch-update-status`, {
		method: "put",
		data: params,
		loading: true
	});
}
// 手动同步库存
export async function batchSnycStock(params) {
	return request(`/new-goods/goods/combination/sku/sync-stock-by-hand`, {
		method: "post",
		data: params,
		loading: true
	});
}
// 获取导入模板的下载路径
export async function getImportTemplateUrl(params) {
	return request(`/blade-log/taskInfo/getImportTemplateUrl?${stringify(params)}`, { loading: true });
}

// 组合装解析公式列表
export async function getDelimiterConfig(params) {
	return request(`/new-goods/delimiter-config/byUuid?${stringify(params)}`, { loading: true });
}

// 删除组合装解析公式
export async function delimiterConfigDelete(params) {
	return request(`/new-goods/delimiter-config/delete`, {
		method: "DELETE",
		data: params,
		loading: true
	});
}
// 新增组合装解析公式
export async function delimiterConfigSave(params) {
	return request(`/new-goods/delimiter-config/save`, {
		method: "PUT",
		data: params,
		loading: true
	});
}
// 操作人列表
export async function queryTakeUserList(params) {
	return request(`/blade-user/user/getUserListByUuid`, {
		method: "post",
		data: params,
		loading: true
	});
}
export async function getGoodsCombinationLogPage(params) {
	return request(`/new-goods/goods-combination-sku-log/page?${stringify(params)}`, {});
}

//通过店铺名称模糊跟店铺ID查询分页列表
export async function getZJFStorePage(params) {
	return request(`/zjf-wms/store/findDaifaStorePage`, {
		method: "POST",
		loading: false,
		data: params
	});
}
// 查询生成系统商品规则配置
export async function getGenerateRulesConfig(params) {
	return request(`/new-goods/generate-rules-config/byUuid?${stringify(params)}`, {
		loading: false
	});
}
// 保存生成系统商品规则配置
export async function saveGenerateRulesConfig(params) {
	return request(`/new-goods/generate-rules-config/save`, {
		method: "POST",
		data: params,
		loading: true
	});
}

//获取店铺表格数据;
export async function getTableDataOp(params) {
	return request(`/blade-goods/newSystem/ecStore/newSystemEcStoreList`, {
		method: "post",
		data: params
	});
}

//待生成组合商品数量
export async function queryWaitCreateCombination(params) {
	return request(`/new-goods/goods/waitCreateCombination/count?${stringify(params)}`, {});
}

//待生成组合商品列表
export async function queryWaitCreateCombinationList(params) {
	return request(`/new-goods/goods/waitCreateCombination/list?${stringify(params)}`, {});
}

//根据筛选条件，获取所有待生成组合商品ids
export async function waitCreateCombinationIds(params) {
	return request(`/new-goods/goods/waitCreateCombination/getAllIds?${stringify(params)}`, {});
}

//待生成组合商品创建
export async function createCombinationSku(params) {
	return request(`/new-goods/goods/waitCreateCombination/createCombinationSku`, {
		method: "post",
		data: params
	});
}

//待生成组合商品删除
export async function deleteCombinationSku(params) {
	return request(`/new-goods/goods/waitCreateCombination/delete`, {
		method: "post",
		data: params
	});
}
